'''
Created on 17.08.2011

@author: osman
'''

import opf
from pets_ontology import Pets, Pet, Cat
from people_ontology import People, Person

@People.atomic
def isCloseRelativeOf(human1: Person, human2: Person): return True

@Pets.atomic
def hasOwner(pet: Pet, owner: Person) -> 'has owner':
    return True

@Pets
def hasCoOwner(pet: Pet, owner: opf.exists(Person), coOwner: Person) -> 'has co-owner':
    hasOwner(pet, owner), isCloseRelativeOf(owner, coOwner)


family = opf.Ontology()

@family.atomic
def know(person: Person, what: opf.Topic):
    return True

# create new topic:
t1 = family.topic()

# add some information to our new topic:
with t1:
    Tiger = Cat("Tiger")
    Robert = Person("Robert")
    Mary = Person("Mary")
    hasOwner(Tiger, Robert)
    isCloseRelativeOf(Robert, Mary)

with family:
    Ivan = Person("Ivan")
    know(Ivan, t1)

for x in family.graph: print(x)
